package com.lyz.dataStructure.algorithm.zijietiaodong2020;/**
 * @Author:759057893@qq.com Lyz
 * @Date: ${Date} 19:59
 * @Description:
 **/

import java.util.Scanner;

/**
 *@Author:759057893@qq.com Lyz
 *@Date: 2019/8/11 19:59
 *@Description:
 **/
public class Main3 {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int[] arr=new int[n];
        int[] m=new int[n];
        for(int i=0;i<n;i++) {
            arr[i] = sc.nextInt();
        }
        int minIndex=arr[0];
        for(int i=1;i<n;i++) {
            if(minIndex>arr[i])
                minIndex=arr[i];
        }
        m[minIndex]=100;
        if(minIndex<n) {
            for(int j=minIndex+1;j<n;j++) {
                if(arr[j]>arr[j-1]) {
                    m[j]=m[j-1]+100;
                }else if(arr[j]<arr[j-1]) {
                    m[j]=m[j-1]-100;
                }else {
                    m[j]=m[j-1];
                }
            }
        }
        for(int k=minIndex-1;k>=0;k--) {
            if(arr[k]>arr[k+1]) {
                m[k]=m[k+1]+100;
            }else if(arr[k]<arr[k+1]) {
                m[k]=m[k+1]-100;
            }else {
                m[k]=m[k+1];
            }
        }
        int sum=0;
        for(int num:m) {
            sum+=num;
        }
        System.out.println(sum);
    }
}
